<?php


$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("cs410", $con);

$fh=fopen("image/user1.jpg", "r");

$data = addslashes(fread($fh, filesize("image/user1.jpg")));

fclose($fh);

//Create the query
$SQL="UPDATE accountdb SET picture = '$data' WHERE userID = '1'";

//Execute the query
$RESULT = mysql_query($SQL) or die(mysql_error());

mysql_close($con);

?>